home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / pc / what's new / technical documentation / macintosh technotes and q&as / technotes / tn / tn1137.hqx / InterruptDisableLib1.0b2 / Read Me — InterruptDisableLib < prev   
Encoding:
Text File  |  1998-09-15  |  3.2 KB  |  64 lines

  1. Read Me About InterruptDisableLib
  2.  
  3. 1.0b2
  4.  
  5. DTS has (and always will) recommend that third party developers avoid disabling interrupts under Mac OS. [See below for rationale and alternatives.] However, we recognize that, given the limitations of the traditional Mac OS, disabling interrupts is sometimes the only solution to your problems. The purpose of this sample is to minimize errors when performing this tricky task, not to encourage you to disable interrupts needlessly.
  6.  
  7. This sample demonstrates how to disable and re-enable interrupts from C and Pascal code compiled for 68K, CFM-68K and PowerPC architectures.  The sample comes in the form of a "drop-in" library that you can use in your code whenever you need to disable interrupts.
  8.  
  9. The sample was designed as an annex to DTS Technote “Disabling Interrupts on the Traditional Mac OS”. You should read the technote before using this sample.
  10.  
  11. Using the Sample
  12.  
  13. Packing List
  14.  
  15. The sample contains the following items:
  16.  
  17. • Read Me — InterruptDisableLib — This document.
  18. • InterruptDisableLib.c — The C source to the library.
  19. • InterruptDisableLib.h — The C header file for the library.
  20. • InterruptDisableLib.p — The Pascal interface to the library.
  21. • TestInterruptDisableLib — A folder containing a test program.
  22.  
  23. Using the Library
  24.  
  25. The sample was built and tested using the Metrowerks CodeWarrior Pro 2 C and Pascal compilers, however you should be able to use the source from any C, C++ or Pascal compiler. To use it in your project, you need to take the following steps:
  26.  
  27. 1. Add the “InterruptDisableLib.c” file to your program. If you’re using an integrated development that supports C code, you will be able to add it directly to your project. Otherwise you may need to compile it separately and add it as an object file.
  28.  
  29. 2. Include the appropriate interface file. For C/C++ programmers, you should include “InterruptDisableLib.h”. Pascal programmers should use “InterruptDisableLib.p”.
  30.  
  31. 3. When you need to disable interrupts, do so using:
  32.  
  33.     oldMask = SetInterruptMask(7);
  34.  
  35.     // Interrupts are disabled, do your stuff!
  36.  
  37.     (void) SetInterruptMask(oldMask);
  38.  
  39. 4. You can also use the GetInterruptMask function to get the current interrupt mask.
  40.  
  41. The Test Program
  42.  
  43. Included with the sample is a test project that demonstrates the effectiveness of library. The project contains 5 targets, one for each of the C 68K, Pascal 68K, C PPC, Pascal PPC, and C CFM-68K executables. There are also 5 compiled executables that you can run without having to dig out your compiler.
  44.  
  45. Note that the test program is designed to test the effectiveness of the library, not to demonstrate how it should be used.
  46.  
  47. Credits and Version History
  48.  
  49. If you find any problems with this sample, mail <DTS@apple.com> with “Attn: Quinn” as the first line of your mail and I’ll try to fix them up.
  50.  
  51. 1.0d1 (Feb 1998) was distributed to a limited number of developers who asked questions about this.
  52.  
  53. 1.0b1 (Feb 1998) was the first shipping version.
  54.  
  55. 1.0b2 (Jul 1998) is an update for CodeWarrior Pro 2 and to correct some documentation errors.  No code changes from 1.0b1.
  56.  
  57. Share and Enjoy.
  58.  
  59. Quinn “The Eskimo!”
  60. Apple Developer Technical Support
  61. Networking, Communications, Hardware
  62.  
  63. 14 Jul 1998
  64.